package com.hxx.common.core.wcontour.enums;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * 气象降水颜色对应枚举
 *
 * @author hxd
 */
public enum RainColorEnum {

    /**
     * 值:0,1,2,5,10,15,20,25,30,40,50,70,100,150,200,2000
     * 色:#000000,#C9FCFD,#9CFFFA,#02CFFC,#4785DA,#2E9A09,#3EF90C,#F1FC00,#EDC42A,#FC6804,#FF0000,#FF0000,#CA05CE,
     * #FC00F3,#FD67FC,#FFCBFB
     */
    
    T_0(0, "#ffffff"),
    T_1(0.1, "#C9FCFD"),
    T_2(0.2, "#9CFFFA"),
    T_5(0.5, "#02CFFC"),
    T_10(1, "#4785DA"),
    T_15(1.5, "#2E9A09"),
    T_20(10, "#3EF90C"),
    T_25(20, "#F1FC00"),
    T_30(30, "#EDC42A"),
    T_40(40, "#FC6804"),
    T_50(50, "#FF0000"),
    T_70(70, "#FF0000"),
    T_100(100, "#CA05CE"),
    T_150(150, "#FC00F3"),
    T_200(200, "#FD67FC"),
    T_2000(2000, "#FFCBFB");
    
    RainColorEnum(double value, String color) {
        this.value = value;
        this.color = color;
    }

    /**
     * 检测值
     */
    private double value;

    /**
     * 温度对应颜色
     */
    private String color;

    public double getValue() {
        return value;
    }

    public String getColor() {
        return color;
    }

    /**
     * 摄氏度数组
     *
     * @return
     */
    public static double[] getValueArray() {
        int length = RainColorEnum.values().length;
        double[] tempArray = new double[length];
        int i = 0;
        for (RainColorEnum anEnum : RainColorEnum.values()) {
            tempArray[i++] = anEnum.value;
        }
        return tempArray;
    }

    /**
     * 温度对应颜色Map
     *
     * @return
     */
    public static Map<Double, String> getValueColorMap() {
        Map<Double, String> map = new LinkedHashMap<>();
        for (RainColorEnum anEnum : RainColorEnum.values()) {
            map.put(anEnum.value, anEnum.getColor());
        }
        return map;
    }
}
